#! /bin/sh

confdir=`pwd`

# If the cache doesn't already exist, build it.

mcache=Makefile.local

if [ ! -f $mcache ]; then
    echo '## DO NOT EDIT THIS FILE DIRECTLY, EDIT THE configure SCRIPT' > $mcache
    echo '##' >> $mcache

    # First, load the regular config settings.

    echo SRCDIR=`dirname $confdir` >> $mcache
    echo 'include $(SRCDIR)/config/Makefile.config' >> $mcache

    # Now any site-specific ones.

    if [ -f Makefile.site ]; then
	echo 'include $(SRCDIR)/config/Makefile.site' >> $mcache
    fi

    # Check for AFNI.

    AFNI=`which afni 2>/dev/null`
    if [ -n "$AFNI" ]; then
	echo "AFNI =" $AFNI >> $mcache
    fi

    # Now we can do checks for things with the other variables set.
    # If we want to.
    ## make >> $mcache
fi

echo $confdir
